﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AzureDiagMon.Common.Helpers.Azure
{
    public static class AzureDateTime
    {
        public static DateTime ToDateTime(this long tick)
        {
            return new DateTime(tick);
        }

        public static DateTime ToLocalDateTime(this long tick)
        {
            return TimeZoneInfo.ConvertTimeFromUtc(tick.ToDateTime(), TimeZoneInfo.Local);
        }

        public static long ToWadLogPartitionKey(this DateTime dateTime)
        {
            //TODO: Review this
            //dateTime = dateTime.AddSeconds(-dateTime.Second);
            dateTime = dateTime.ToUniversalTime();
            return dateTime.Ticks;
        }
    }
}
